package cn.adkii.basic.test.demo;

import cn.adkii.base.demo.spi.Search;
import org.junit.Test;

import java.util.Iterator;
import java.util.ServiceLoader;

/**
 * @author malingdi
 * @description 测试SPI
 * @date 2023/11/27 11:23
 */
public class ApiSpi {

    @Test
    public void test_spi(){
        ServiceLoader<Search> s = ServiceLoader.load(Search.class);
        Iterator<Search> iterator = s.iterator();
        while (iterator.hasNext()){
            Search search = iterator.next();
            search.searchDoc("hello world");
        }
    }
}
